home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / SCRIB3.PAK / SCRIBBLE.CPP < prev    next >
C/C++ Source or Header  |  1997-05-06  |  5KB  |  173 lines

  1. // Scribble.cpp : Defines the class behaviors for the application.
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1995 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "Scribble.h"
  15.  
  16. #include "MainFrm.h"
  17. #include "ChildFrm.h"
  18. #include "ScribDoc.h"
  19. #include "ScribVw.h"
  20.  
  21. #ifdef _DEBUG
  22. #define new DEBUG_NEW
  23. #undef THIS_FILE
  24. static char THIS_FILE[] = __FILE__;
  25. #endif
  26.  
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CScribbleApp
  29.  
  30. BEGIN_MESSAGE_MAP(CScribbleApp, CWinApp)
  31.     //{{AFX_MSG_MAP(CScribbleApp)
  32.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  33.         // NOTE - the ClassWizard will add and remove mapping macros here.
  34.         //    DO NOT EDIT what you see in these blocks of generated code!
  35.     //}}AFX_MSG_MAP
  36.     // Standard file based document commands
  37.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  38.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  39.     // Standard print setup command
  40.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  41. END_MESSAGE_MAP()
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // CScribbleApp construction
  45.  
  46. CScribbleApp::CScribbleApp()
  47. {
  48.     // TODO: add construction code here,
  49.     // Place all significant initialization in InitInstance
  50. }
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53. // The one and only CScribbleApp object
  54.  
  55. CScribbleApp theApp;
  56.  
  57. /////////////////////////////////////////////////////////////////////////////
  58. // CScribbleApp initialization
  59.  
  60. BOOL CScribbleApp::InitInstance()
  61. {
  62.     // Standard initialization
  63.     // If you are not using these features and wish to reduce the size
  64.     //  of your final executable, you should remove from the following
  65.     //  the specific initialization routines you do not need.
  66.  
  67. #ifdef _AFXDLL
  68.     Enable3dControls();                     // Call this when using MFC in a shared DLL
  69. #else
  70.     Enable3dControlsStatic();       // Call this when linking to MFC statically
  71. #endif
  72.  
  73.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  74.  
  75.     
  76.     // Register the application's document templates.  Document templates
  77.     //  serve as the connection between documents, frame windows and views.
  78.  
  79.     CMultiDocTemplate* pDocTemplate;
  80.     pDocTemplate = new CMultiDocTemplate(
  81.         IDR_SCRIBBTYPE,
  82.         RUNTIME_CLASS(CScribbleDoc),
  83.         RUNTIME_CLASS(CChildFrame), // custom MDI child frame
  84.         RUNTIME_CLASS(CScribbleView));
  85.  
  86.     AddDocTemplate(pDocTemplate);
  87.  
  88.     // create main MDI Frame window
  89.     CMainFrame* pMainFrame = new CMainFrame;
  90.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  91.         return FALSE;
  92.     m_pMainWnd = pMainFrame;
  93.  
  94.     // Enable drag/drop open.  We don't call this in Win32, since a
  95.     //  document file extension wasn't chosen while running AppWizard.
  96.     m_pMainWnd->DragAcceptFiles();
  97.  
  98.     // Enable DDE Execute open
  99.     EnableShellOpen();
  100.     RegisterShellFileTypes(TRUE);
  101.  
  102.     // Parse command line for standard shell commands, DDE, file open
  103.     CCommandLineInfo cmdInfo;
  104.     ParseCommandLine(cmdInfo);
  105.  
  106.     // Dispatch commands specified on the command line
  107.     if (!ProcessShellCommand(cmdInfo))
  108.         return FALSE;
  109.  
  110.     
  111.     // The main window has been initialized, so show and update it.
  112.     pMainFrame->ShowWindow(m_nCmdShow);
  113.     pMainFrame->UpdateWindow();
  114.  
  115.     return TRUE;
  116. }
  117.  
  118. /////////////////////////////////////////////////////////////////////////////
  119. // CAboutDlg dialog used for App About
  120.  
  121. class CAboutDlg : public CDialog
  122. {
  123. public:
  124.     CAboutDlg();
  125.  
  126. // Dialog Data
  127.     //{{AFX_DATA(CAboutDlg)
  128.     enum { IDD = IDD_ABOUTBOX };
  129.     //}}AFX_DATA
  130.     
  131.     // ClassWizard generated virtual function overrides
  132.     //{{AFX_VIRTUAL(CAboutDlg)
  133.     protected:
  134.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  135.     //}}AFX_VIRTUAL
  136.  
  137. // Implementation
  138. protected:
  139.     //{{AFX_MSG(CAboutDlg)
  140.         // No message handlers
  141.     //}}AFX_MSG
  142.     DECLARE_MESSAGE_MAP()
  143. };
  144.  
  145. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  146. {
  147.     //{{AFX_DATA_INIT(CAboutDlg)
  148.     //}}AFX_DATA_INIT
  149. }
  150.  
  151. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  152. {
  153.     CDialog::DoDataExchange(pDX);
  154.     //{{AFX_DATA_MAP(CAboutDlg)
  155.     //}}AFX_DATA_MAP
  156. }
  157.  
  158. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  159.     //{{AFX_MSG_MAP(CAboutDlg)
  160.         // No message handlers
  161.     //}}AFX_MSG_MAP
  162. END_MESSAGE_MAP()
  163.  
  164. // App command to run the dialog
  165. void CScribbleApp::OnAppAbout()
  166. {
  167.     CAboutDlg aboutDlg;
  168.     aboutDlg.DoModal();
  169. }
  170.  
  171. /////////////////////////////////////////////////////////////////////////////
  172. // CScribbleApp commands
  173.